package com.cash.app.constant

import com.cash.app.BuildConfig

object AppConstant {

    const val SPLASH_JUMP_TIME = 2000L

    const val K_GA_ID = "GA_ID"
    const val K_GP_REFERRER = "GP_REFERRER"
    const val K_WX_CODE = "wx_code"// must lowercase
    const val K_AJ_ID = "aj_id" // must lowercase
    const val K_CHANNEL = "channel"  // must lowercase
    const val K_APP_LATITUDE = "Latitude"
    const val K_APP_LONGITUDE = "Longitude"
    const val K_APP_ADDRESS = "Address"
    const val K_PP_GRANTED = "PP_Granted"
    const val K_APP_LOGIN = "App_Login"
    const val K_APP_CHECK = "App_Check"
    const val K_APP_SHOW_UPDATE = "Show_Update"

    const val REPAY_CHANNEL_APP = "A"
    const val REPAY_CHANNEL_BROWSER = "B"
    const val LOAN_CONFIRM_ITEM_SIZE = 2
    const val HTTP = "https://"
    const val PHONE_LENGTH = 10
    const val FEEDBACK_SELECT_PHOTO_MAX = 3
    const val IMAGE_BASE_64 = "data:image/jpeg;base64,"

    const val APP_GP_REFERRER = "bkdd_test"
    const val APP_CHANNEL = "test"
    const val LOGIN_IS_CHECK = 1

    const val APP_UPDATE_NOT = 0
    const val APP_UPDATE_OPTIONAL = 1
    const val APP_UPDATE_FORCE = 2
    const val APP_WINDOW_OPEN = 1

    const val GENDER_MALE = 1
    const val GENDER_MALE_STRING = "MALE"
    const val GENDER_FEMALE = 2
    const val GENDER_FEMALE_STRING = "FEMALE"

    const val AUTH_TYPE_BASIC = 1
    const val AUTH_TYPE_PERSONAL = 2
    const val AUTH_TYPE_BANK = 5

    // auth ocr image type
    const val AUTH_SELFIE = 0
    const val AUTH_AADHAAR_FRONT = 1
    const val AUTH_AADHAAR_BACK = 2
    const val AUTH_PAN_CARD = 3

    // auth option
    const val AUTH_O_EDUCATION = "Education"
    const val AUTH_O_MARITAL = "Marital status"
    const val AUTH_O_CHILDREN = "Number of children"
    const val AUTH_O_CAREER = "Career"
    const val AUTH_O_INCOME = "Monthly income"
    const val AUTH_O_FIRST_CONTACT = "First relationship"
    const val AUTH_O_SECOND_CONTACT = "Second relationship"
    const val AUTH_O_REQUEST_OPTION = 100

    const val KEY_GET_APP_LIST = "get_app_list"
    const val KEY_GET_SMS_LIST = "get_sms_list"
    const val KEY_GET_EXTRA_INFO = "get_extra_info"
    const val SMS_TYPE_OTHER = 0
    const val SMS_TYPE_OUT = 1
    const val SMS_TYPE_IN = 2

    const val LOGIN_COUNT_DOWN = 60 * 1000L
    const val LOGIN_COUNT_DOWN_INTERVAL = 1000L
    const val NET_TIMEOUT = 130L

    val SMS_KEYWORDS = listOf(
        "debit",
        "credit",
        "balance",
        "money",
        "transfer",
        "spent",
        "deposit",
        "paid",
        "pay",
        "emi",
        "due"
    )

    // app net host
    const val API_HOST_D = BuildConfig.API_URI
    const val API_HOST_R = BuildConfig.API_URI
    const val PATH_API_RETRY = BuildConfig.API_URI
    const val API_HOST_BACKUP = BuildConfig.API_URI
    const val API_RETRY_COUNT = 1

    // API Constants
    // basic
    const val API_TEMP_TOKEN = "/api/account/get-token-before-login"
    const val API_GLOBAL_CONFIG = "/api/basic/global"
    const val API_GET_CHANNEL = "/api/basic/get-channel"
    const val API_APP_START = "/api/basic/start"

    // upload extra
    const val API_ADD_SHARE = "/api/basic/add-share"
    const val API_MOVE_THIRD = "/api/basic/move-third"
    const val API_UPLOAD_HARDWARE = "/api/basic/upload-hardware"

    // login
    const val API_LOGIN = "/api/account/login"
    const val API_GET_CODE = "/api/account/get-code"
    const val API_QUIT = "/api/account/quit"

    // home/account
    const val API_HOME_DATA = "/api/index/index"
    const val API_ACCOUNT_DETAIL = "/api/account/detail"
    const val API_VIP_PRODUCT = "/api/index/special"

    // repay
    const val API_TO_REPAY = "/api/order/to-repay"
    const val API_FAST_APPLY = "/api/order/fast-apply"

    // repay/order list
    const val API_LOAN_LIST = "/api/order/loan-list"
    const val API_LOAN_DETAIL = "/api/order/detail"

    // apply loan
    const val API_SHOW_REAL_PRODUCT = "/api/order/show-real-product"
    const val API_PREPARE = "/api/order/prepare"
    const val API_RECOMMEND = "/api/index/recommend"
    const val API_BATCH_APPLY = "/api/order/batch-apply"
    const val API_CAN_SCORING = "/api/index/can-scoring"
    const val API_SCORING = "/api/index/scoring"

    // feedback
    const val API_GET_FEEDBACK_LIST = "/api/account/get-comment"
    const val API_SUBMIT_FEEDBACK = "/api/account/add-comment"

    // Auth API
    const val API_GET_AUTH_INFO_BY_TYPE = "/api/account/get-info-by-type"
    const val API_OCR = "/api/account/ocr"
    const val API_SUBMIT_STEP_ONE = "/api/account/step1"
    const val API_GET_META_DATA = "/api/basic/get-meta"
    const val API_SUBMIT_STEP_TWO = "/api/account/step2"
    const val API_BIND_BANK = "/api/account/add-card"

    // Order can loan
    const val CAN_LOAN = 1
    const val CAN_NOT_LOAN = 0
    const val TYPE_LOAN_LIST_ALL = 0
    const val TYPE_LOAN_LIST_REPAY = 1
    const val RATING_LIKE = 1
    const val RATING_DISLIKE = 2

    // Order Status Constants
    const val OS_EMPTY = 0 // Default
    const val OS_UNDER_REVIEW = 2 // Under Review
    const val OS_AUDIT_FAILED = 3 // Audit Failed
    const val OS_PENDING_PAYMENT = 6 // Pending Payment
    const val OS_FAILURE_PAYMENT = 7 // Failure Payment
    const val OS_PENDING_REPAY = 8 // Pending Repay
    const val OS_REPAID_REPAYMENT = 9 // Repaid Repayment
    const val OS_OVERDUE = 10 // Overdue
    const val OS_MODIFY_BANK_INFO = 20 // Modify Bank Info

    // Order Status Text
    const val OST_GET_CREDIT = "Get Crash"
    const val OST_GET_CREDIT1 = "Get crash"
    const val OST_UNDER_REVIEW = "Under Review"
    const val OST_AUDIT_FAILED = "Audit Failed"
    const val OST_PENDING_PAYMENT = "Pending Payment"
    const val OST_FAILURE_PAYMENT = "Payment Failed"
    const val OST_PENDING_REPAY = "Pending Repayment"
    const val OST_REPAID_REPAYMENT = "Repaid Repayment"
    const val OST_OVERDUE = "Overdue"
    const val OST_MODIFY_BANK_INFO = "Modify Bank Info"
    const val OST_UNKNOWN = "Unknown"

    // Get Order Status Text Function
    fun getOrderStatusText(status: Int): String {
        return when (status) {
            OS_UNDER_REVIEW -> OST_UNDER_REVIEW
            OS_AUDIT_FAILED -> OST_AUDIT_FAILED
            OS_PENDING_PAYMENT -> OST_PENDING_PAYMENT
            OS_FAILURE_PAYMENT -> OST_FAILURE_PAYMENT
            OS_PENDING_REPAY -> OST_PENDING_REPAY
            OS_REPAID_REPAYMENT -> OST_REPAID_REPAYMENT
            OS_OVERDUE -> OST_OVERDUE
            OS_MODIFY_BANK_INFO -> OST_MODIFY_BANK_INFO
            else -> OST_UNKNOWN
        }
    }
}